package com.appspot.battlerafts.classes;

import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

/**
 * Created with IntelliJ IDEA.
 * User: Tonis
 * Date: 31.03.12
 * Time: 20:54
 * To change this template use File | Settings | File Templates.
 */

@PersistenceCapable(detachable="true")
public class User {

    @PrimaryKey
    private Long UID;

    @Persistent
    private int score;

    @Persistent
    private String name;

    @Persistent
    private int nrOfPlayedGames;

    @Persistent
    private boolean isOnline;

    @Persistent
    private String currentSocketID;

    public String getCurrentSocketID() {
        return currentSocketID;
    }

    public void setCurrentSocketID(String currentSocketID) {
        this.currentSocketID = currentSocketID;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public User(Long UID) {
        this.UID = UID;
        this.nrOfPlayedGames = 0;
        this.score = 0;
        this.isOnline = true;
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }

    public int getNrOfPlayedGames() {
        return nrOfPlayedGames;
    }

    public void setNrOfPlayedGames(int nrOfPlayedGames) {
        this.nrOfPlayedGames = nrOfPlayedGames;
    }

    public boolean isOnline() {
        return isOnline;
    }

    public void setOnline(boolean online) {
        isOnline = online;
    }

    public Long getUID() {

        return UID;
    }
    @Override
    public String toString(){
        return "NAME: " + this.name + "; UID: " + this.getUID() + "; SocketID: " + this.getCurrentSocketID() + "; Score: " +  this.getScore() + "; played games: " +  this.getNrOfPlayedGames();
    }
}
